package co.fitstart.entity.market;

import com.demo2do.core.utils.Alias;

/**
 * 
 * @author dan
 *
 */
@Alias("achievementType")
public enum AchievementType {
    
    THREE_DAY("three_day", 3, "三天"),
    
    ONE_WEEK("one_week", 7, "一个周"),
    
    ONE_MONTH("one_month", 30, "一个月"),
    
    TWO_MONTH("two_month", 60, "两个月"),
    
    THREE_MONTH("three_month", 90, "三个月"),
    
    FOUR_MONTH("four_month", 120, "四个月");
    
    private String alias;
    
    private int amount;
    
    private String description;
    
    private AchievementType(String alias, int amount, String description) {
        this.alias = alias;
        this.amount = amount;
        this.description = description;
    }
    
    /**
     * 
     * @param alias
     * @return
     */
    public static AchievementType aliasOf(String alias) {
        for (AchievementType achievementType : AchievementType.values()) {
            if (achievementType.getAlias().equalsIgnoreCase(alias)) {
                return achievementType;
            }
        }
        
        return null;
    }
    
    /**
     * 
     * @param amount
     * @return
     */
    public static AchievementType amountOf(int amount) {
        for (AchievementType achievementType : AchievementType.values()) {
            if (achievementType.getAmount() == amount) {
                return achievementType;
            }
        }
        
        return null;
    }

    /**
     * @return the alias
     */
    public String getAlias() {
        return alias;
    }

    /**
     * @return the amount
     */
    public int getAmount() {
        return amount;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param alias the alias to set
     */
    public void setAlias(String alias) {
        this.alias = alias;
    }

    /**
     * @param amount the amount to set
     */
    public void setAmount(int amount) {
        this.amount = amount;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

}
